﻿import request from '/@/utils/request';
enum Api {
  AddDeviceSlaveTemplatePoints = '/api/deviceSlaveTemplatePoints/add',
  DeleteDeviceSlaveTemplatePoints = '/api/deviceSlaveTemplatePoints/delete',
  DeleteByDeviceSlaveTemplateId = '/api/deviceSlaveTemplatePoints/deleteByDeviceSlaveTemplateId',
  UpdateDeviceSlaveTemplatePoints = '/api/deviceSlaveTemplatePoints/update',
  PageDeviceSlaveTemplatePoints = '/api/deviceSlaveTemplatePoints/page',
  DetailDeviceSlaveTemplatePoints = '/api/deviceSlaveTemplatePoints/detail',
  GetDeviceSlaveTemplateDeviceSlaveTemplateIdDropdown = '/api/deviceSlaveTemplatePoints/DeviceSlaveTemplateDeviceSlaveTemplateIdDropdown',
  importDeviceSlaveTemplatePoints='/api/deviceSlaveTemplatePoints/uploadFile',
  GetImportFileTemplate='/api/deviceSlaveTemplatePoints/getImportFileTemplate',
  ExportPoints='/api/deviceSlaveTemplatePoints/exportPoints',
}

// 增加从机变量
export const addDeviceSlaveTemplatePoints = (params?: any) =>
	request({
		url: Api.AddDeviceSlaveTemplatePoints,
		method: 'post',
		data: params,
	});

// 删除从机变量
export const deleteDeviceSlaveTemplatePoints = (params?: any) => 
	request({
			url: Api.DeleteDeviceSlaveTemplatePoints,
			method: 'post',
			data: params,
		});
// 删除从机变量
export const deleteByDeviceSlaveTemplateId = (params?: any) => 
	request({
			url: Api.DeleteByDeviceSlaveTemplateId,
			method: 'post',
			data: params,
		});

// 编辑从机变量
export const updateDeviceSlaveTemplatePoints = (params?: any) => 
	request({
			url: Api.UpdateDeviceSlaveTemplatePoints,
			method: 'post',
			data: params,
		});

// 分页查询从机变量
export const pageDeviceSlaveTemplatePoints = (params?: any) => 
	request({
			url: Api.PageDeviceSlaveTemplatePoints,
			method: 'post',
			data: params,
		});

// 详情从机变量
export const detailDeviceSlaveTemplatePoints = (id: any) => 
	request({
			url: Api.DetailDeviceSlaveTemplatePoints,
			method: 'get',
			data: { id },
		});

export const getDeviceSlaveTemplateDeviceSlaveTemplateIdDropdown = () =>
		request({
		url: Api.GetDeviceSlaveTemplateDeviceSlaveTemplateIdDropdown,
		method: 'get'
		});
// 导入从机变量
export const importDeviceSlaveTemplatePoints = (params?: any) =>
	request({
		url: Api.importDeviceSlaveTemplatePoints,
		method: 'post',
		data: params,
		headers: {
            'Content-Type': 'multipart/form-data'
        }
	});

	// 详情从机变量
export const getImportFileTemplate = () => 
	request({
			url: Api.GetImportFileTemplate,
			method: 'get',
		
		});

		// 详情从机变量
export const exportPoints = (id: any) => 
	request({
			url: Api.ExportPoints,
			method: 'get',
			data: { id },
			responseType: 'blob',
		});
